package mutsumimod.cards.copy;

import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.ui.panels.EnergyPanel;
import mutsumimod.cards.BaseCard;
import mutsumimod.cards.derivative.UnhealthyMutsumi;
import mutsumimod.character.Mutsumi;
import mutsumimod.util.CardStats;

public class UnhealthyUika extends BaseCard  {
    public static final String ID = makeID(UnhealthyUika.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.UNCOMMON,
            CardTarget.SELF,
            0
    );

    public UnhealthyUika() {
        super(ID, info);
        setAttr(0,0,0);
        setAttrUpg(0,0,0);
        originShouldCopyUse = true;
        setShouldCopyUse(true);
        cardsToPreview=new UnhealthyMutsumi();
    }

    @Override
    public void beforeCopy(){
        clearCopyCardsAddSelf();
        UnhealthyMutsumi mutsumi=new UnhealthyMutsumi();
        if(upgraded){
            mutsumi.upgrade();
        }
        addCopyCards(mutsumi);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new MakeTempCardInHandAction(new UnhealthyMutsumi(),EnergyPanel.totalCount));
        p.energy.use(EnergyPanel.totalCount);
    }

    @Override
    public AbstractCard makeCopy() {
        return new UnhealthyUika();
    }

    @Override
    public void updateDescription() {
        if(getInCopyUse()){
            if(upgraded){
                this.rawDescription=cardStrings.EXTENDED_DESCRIPTION[1];
            }else{
                this.rawDescription=cardStrings.EXTENDED_DESCRIPTION[0];
            }
        }else{
            if(upgraded){
                this.rawDescription=cardStrings.UPGRADE_DESCRIPTION;
            }else{
                this.rawDescription=cardStrings.DESCRIPTION;
            }
        }
        initializeDescription();
    }

}